package com.ksd.modules.members.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ksd.common.annotation.ApiLog;
import com.ksd.common.controller.BaseController;
import com.ksd.common.core.result.R;
import com.ksd.common.web.annotation.RepeatSubmit;
import com.ksd.modules.members.po.AdminUserRegisterConfigSavePO;
import com.ksd.modules.members.po.AdminUserRegisterConfigSearchPO;
import com.ksd.modules.members.service.IAdminUserRegisterConfigService;
import com.ksd.modules.members.vo.AdminUserRegisterConfigVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 平台up主用户 前端控制器
 * </p>
 *
 * @author Auto Generator
 * @since 2023-08-15
 */
@RestController
public class AdminUserRegisterConfigController extends BaseController {


    @Autowired
    private IAdminUserRegisterConfigService adminUserRegisterConfigService;

    /**
     * 查询首页平台配置信息模板接口
     * @param adminUserSearchPO
     * @return
     */
    @PostMapping("/users/registerconfig/list")
    public R<Page<AdminUserRegisterConfigVo>> findAdminUserRegisterConfigs(@Validated @RequestBody AdminUserRegisterConfigSearchPO adminUserSearchPO){
        return R.data(adminUserRegisterConfigService.findAdminUserRegisterConfig(adminUserSearchPO));
    }


    /**
     * 【平台配置信息】 - 保存和更新
     * @param adminUsersSavePO
     * @return
     */
    @PostMapping("/users/registerconfig/saveupdate")
    @ApiLog("【平台配置信息】 - 保存和更新")
    @RepeatSubmit
    public R<AdminUserRegisterConfigVo> saveUpdateAdminUserRegisterConfig(@Validated @RequestBody AdminUserRegisterConfigSavePO adminUsersSavePO){
        return R.data(adminUserRegisterConfigService.saveUpdateAdminUserRegisterConfig(adminUsersSavePO));
    }

    /**
     * 【平台配置信息】 - 根据id查询明细
     * @param id
     * @return
     */
    @PostMapping("/users/registerconfig/get/{id}")
    public R<AdminUserRegisterConfigVo> getAdminUserRegisterConfigById(@PathVariable("id")Long id){
        return R.data(adminUserRegisterConfigService.getAdminUserRegisterConfigById(id));
    }
}
